package dbconnection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;

public class DBConnection {
	
	public DBConnection() throws ClassNotFoundException, SQLException{
		
		Class.forName("oracle.jdbc.OracleDriver");
	}
		
	public Connection getConnection() throws SQLException{			//Hoort private
		Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "SCHOOL", "bla");
		return conn;
		
	}
	
	public ResultSet runSQLQuery(String query){
		return null;
	}
	
	public void runSQLStatement(String query) throws SQLException { 
		
		Connection conn = getConnection();
		Statement s = conn.createStatement();
		s.executeUpdate(query);
		conn.close();
		
	}
}
